package com.wzz.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author DarkClown
 * @date 2024-08-03 10:00
 * @project_name week3-try
 * @parem
 **/
@Configuration
public class RabbitConfig {
    @Bean
    public Queue addQueue1(){
        //创建队列
        //第二个参数是持久化消息  防止消费丢失
        return new Queue("addQueue1",true);
    }
    @Bean
    public Queue addQueue2(){
        //创建队列
        //第二个参数是持久化消息  防止消费丢失
        return new Queue("addQueue2",true);
    }

    @Bean
    public DirectExchange directExchange(){
        //创建交换机
        return new DirectExchange("addExchange");
    }

    @Bean
    public Binding addBingDing1(){
        //绑定
        return BindingBuilder.bind(addQueue1()).to(directExchange()).with("");
    }

    @Bean
    public Binding addBingDing2(){
        //绑定
        return BindingBuilder.bind(addQueue2()).to(directExchange()).with("");
    }

}
